package org.mzyyn.qr.controller;

import org.mzyyn.qr.constants.AppletsApiUrlMapping;
import org.mzyyn.qr.dto.assistance.AssistanceSuccessDTO;
import org.mzyyn.qr.service.AssistanceRecordService;
import org.qr.xiaocao.common.entity.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 助力记录表 前端控制器
 * </p>
 *
 * @author lipeng
 * @since 2024-09-03
 */
@RestController
public class AssistanceRecordController {

    @Autowired
    AssistanceRecordService assistanceRecordService;

    /**
     * 成功助力：累计领取奖励
     * @return
     */
    @PostMapping(AppletsApiUrlMapping.ASSISTANCE_SUCCESS)
    public BaseResult assistanceSuccess(
            @RequestBody @Validated AssistanceSuccessDTO assistanceSuccessDTO
    ){
        assistanceRecordService.assistanceSuccess(assistanceSuccessDTO);
        return BaseResult.ok();
    }

    /**
     * 成功助力实时奖励
     * @return
     */
    @PostMapping(AppletsApiUrlMapping.ASSISTANCE_SUCCESS_SHISHI)
    public BaseResult successShishi(
            @RequestBody @Validated AssistanceSuccessDTO assistanceSuccessDTO
    ){
        assistanceRecordService.assistanceSuccessShishi(assistanceSuccessDTO);
        return BaseResult.ok();
    }

    /**
     * 互成功助力
     * @return
     */
    @PostMapping(AppletsApiUrlMapping.ASSISTANCE_HUZHU_SUCCESS)
    public BaseResult huzhuSuccess(
            @RequestBody @Validated AssistanceSuccessDTO assistanceSuccessDTO
    ){
        assistanceRecordService.huzhuSuccess(assistanceSuccessDTO);
        return BaseResult.ok();
    }
}
